module lang.d.sts.expressions.dbinaryexpression;

import lang.d.sts.expressions.dexpression;
import lang.d.tokens.tokentype;
import lang.d.visitors.dvisitor;

class DBinaryExpression: DExpression {
    private TokenType myOperation;
    private DExpression myLeft;
    private DExpression myRight;

    public this(in TokenType type) {
        myOperation = type;
    }

    public void setLeftExpression(DExpression expr) {
        myLeft = expr;
        expr.setParent(this);
    }

    public void setRightExpression(DExpression expr) {
        myRight = expr;
        expr.setParent(this);
    }

    public DExpression getLeftExpression() {
        return myLeft;
    }

    public DExpression getRightExpression() {
        return myRight;
    }

    public TokenType getOperation() const {
        return myOperation;
    }

    override public void accept(DVisitor visitor) {
        visitor.visitBinaryExpression(this);
    }
}
